<template>
  <div class="app-container">
    <el-radio-group v-model="tabValue" class="tab" size="small">
      <el-radio-button v-hasPermi="[parkInside]" label="1">月卡车辆</el-radio-button>
      <el-radio-button v-hasPermi="[innerCar]" label="2">内部车辆</el-radio-button>
      <el-radio-button v-hasPermi="[blacklistCar]" label="3">管控车辆</el-radio-button>
      <el-radio-button v-hasPermi="[newEnergyCar]" label="4">新能源车辆</el-radio-button>
      <el-radio-button v-hasPermi="[ownerListCar]" label="5">业主车辆</el-radio-button>
    </el-radio-group>
    <parkInside v-if="tabValue==='1'" />
    <innerCar v-if="tabValue==='2'" />
    <blackListCar v-if="tabValue==='3'" />
    <newEnergyListCar v-if="tabValue==='4'" />
    <ownerCar v-if="tabValue==='5'" />
  </div>
</template>
<script>
import parkInside from '@/views/business/parkInside'
import innerCar from '@/views/business/innerCar'
import blackListCar from '@/views/business/blacklistCar'
import newEnergyListCar from '@/views/business/newEnergyListCar'
import ownerCar from '@/views/business/ownerCar'
export default {
  components: {
    parkInside,
    innerCar,
    blackListCar,
    newEnergyListCar,
    ownerCar,
  },
  data() {
    return {
      tabValue: '1',
      parkInside: 'admin:parkInside:list',
      innerCar: 'admin:innerCar:list',
      blacklistCar: 'admin:blacklistCar:list',
      newEnergyCar:'admin:newEnergy:list',
      ownerListCar:'admin:ownerCar:list',
    }
  },
  created() {
    const user = this.$store.state.user
    const perms = user.perms
    // console.log(perms)
    const flag = !!perms.find(item => item == this.parkInside)
    const flag1 = !!perms.find(item => item == this.innerCar)
    const flag2 = !!perms.find(item => item == this.blacklistCar)
    const flag3 = !!perms.find(item => item == this.newEnergyCar)
    const flag4 = !!perms.find(item => item == this.ownerListCar)
    if (flag || perms[0] == '*'){
      this.tabValue = '1'
    }else if(flag1 || perms[0] == '*'){
      this.tabValue = '2'
    }else if(flag2 || perms[0] == '*'){
      this.tabValue = '3'
    }else if(flag3 || perms[0] == '*'){
      this.tabValue = '4'
    }else if(flag4 || perms[0] == '*'){
      this.tabValue = '5'
    }
  }
}
</script>
<style lang="scss" scoped>
.tab{
  margin-left: 20px;
}
</style>
